#pragma once
#include <string>
#include <list>
#include <sstream>
#include <vector>
#include <map>
#include "cocos2d.h"
#include "TableReader.h"

USING_NS_CC;
using namespace std;

class GameMusic
{
public:
	GameMusic(){};
	~GameMusic(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string music_dir;
};
class GameMusicTable : public TableReader
{
public:
	GameMusicTable() {  }
	~GameMusicTable() { purge(); }
	bool init(){ init("GameMusic.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _GameMusicList.clear(); };
	const GameMusic* getGameMusicByID(int id) { return _GameMusicList[id];};
	int getSize() { return _GameMusicList.size();};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, GameMusic*> _GameMusicList;
};

class GameEffect
{
public:
	GameEffect(){};
	~GameEffect(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string effect_dir;
};
class GameEffectTable : public TableReader
{
public:
	GameEffectTable() {  }
	~GameEffectTable() { purge(); }
	bool init(){ init("GameEffect.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _GameEffectList.clear(); };
	const GameEffect* getGameEffectByID(int id) { return _GameEffectList[id];};
	int getSize() { return _GameEffectList.size();};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, GameEffect*> _GameEffectList;
};

class BulletModel
{
public:
	BulletModel(){};
	~BulletModel(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string defaultFrame;
	float speed;
	unsigned int netId;
};
class BulletModelTable : public TableReader
{
public:
	BulletModelTable() {  }
	~BulletModelTable() { purge(); }
	bool init(){ init("BulletModel.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _BulletModelList.clear(); };
	const BulletModel* getBulletModelByID(int id) { return _BulletModelList[id];};
	int getSize() { return _BulletModelList.size();};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, BulletModel*> _BulletModelList;
};

class NetModel
{
public:
	NetModel(){};
	~NetModel(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string netActionName;
	int netActionStart;
	int netActionNum;
	float netActionDelay;
	string netDefaultFrame;
};
class NetModelTable : public TableReader
{
public:
	NetModelTable() {  }
	~NetModelTable() { purge(); }
	bool init(){ init("NetModel.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _NetModelList.clear(); };
	const NetModel* getNetModelByID(int id) { return _NetModelList[id];};
	int getSize() { return _NetModelList.size();};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, NetModel*> _NetModelList;
};

class CannonModel
{
public:
	CannonModel(){};
	~CannonModel(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string defaultFrame;
	string cannonActionName;
	int cannonActionNum;
	float cannonActionDelay;
	string cannonDefaultFrame;
};
class CannonModelTable : public TableReader
{
public:
	CannonModelTable() {  }
	~CannonModelTable() { purge(); }
	bool init(){ init("CannonModel.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _CannonModelList.clear(); };
	const CannonModel* getCannonModelByID(int id) { return _CannonModelList[id];};
	int getSize() { return _CannonModelList.size();};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, CannonModel*> _CannonModelList;
};

class FishModel
{
public:
	FishModel(){};
	~FishModel(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	int modelIndex;
	string fileName;
	string moveAction;
	int moveFrameNum;
	int moveFrameStart;
	float moveDelay;
	string DieAction;
	int DieFrameNum;
	int DieFrameStart;
	float DieDelay;
	string HitAction;
	int HitFrameNum;
	int HitFrameStart;
	float HitDelay;
	string defaultFrame;
	string shapeFile;
};
class FishModelTable : public TableReader
{
public:
	FishModelTable() {  }
	~FishModelTable() { purge(); }
	bool init(){ init("FishModel.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _FishModelList.clear(); };
	const FishModel* getFishModelByID(int id) { return _FishModelList[id];};
	int getSize() { return _FishModelList.size();};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, FishModel*> _FishModelList;
};

